<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <title>闲言后台管理</title>
    <link th:include="fragment/import :: import">
    <style type="text/css">
        dl{
            margin-bottom: 0px;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">闲言后台管理系统</div>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img alt="管理员" class="layui-nav-img" src="/static/images/xyIndex/head.png">
                    管理员
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退了</a></li>
        </ul>
    </div>

    <div class="layui-tab layui-tab-card site-demo-button" style="position: relative;">
        <ul class="layui-nav layui-nav-tree layui-nav-side" style="top: 60px;">
            <li class="layui-nav-item layui-nav-itemed">
                <a class="" href="javascript:;">控制台</a>
                <dl class="layui-nav-child">
                    <dd><a class="site-demo-active" data-id="1" data-title="数据面板" data-type="tabAdd" data-url="/admin/dataBoard" href="#">数据面板</a></dd>
                </dl>
            </li>
            <div id="menu_view"></div>
        </ul>

        <div class="layui-tab" lay-allowclose="true" lay-filter="demo" style="margin-left: 200px;">
            <ul class="layui-tab-title">
            </ul>
            <ul class="rightmenu admin-index-rightmenu" style="display: none;position: absolute;">
                <li data-type="closethis">关闭当前</li>
                <li data-type="closeall">关闭所有</li>
            </ul>
            <div class="layui-tab-content">
            </div>
        </div>

    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script type="text/javascript" src="/static/js/OpenTab.js"></script>

<script>

    $(function () {

        //获取menu.json中的菜单数据
        $.getJSON('/static/menu/menu.json', {}, function (data) {
            var getView = $("#menu_view");
            if (data) {
                $.each(data, function (index, value) {
                    var html = '' +
                        '<li class="layui-nav-item layui-nav-itemed">\n' +
                        '        <a href="javascript:;"> ' + value.title + ' </a>' +
                        ' <dl class="layui-nav-child">';
                    var children = value.children;

                    $.each(children, function (ch_index, ch_value) {
                        html += '<dd>' +
                            '<a class="site-demo-active" data-id="' + ch_value.id + '" data-title="' + ch_value.title + '" data-type="tabAdd" data-url="' + ch_value.url + '" href="#">' + ch_value.title + '</a>' +
                            '</dd>'
                    });

                    html += ' </dl>' +
                        '</li>';
                    getView.prepend(html);

                })
            }

        })
    })
</script>

</body>
</html>